#include "specialKeys.h"

#include "GLFrame.h"
#include "GLMatrixStack.h"

#ifdef __APPLE__
#include <glut/glut.h>
#else
#define FREEGLUT_STATIC
#include <GL/glut.h>
#endif

GLFrame cameraFrame;
GLFrame objectFrame;

// Respond to arrow keys by moving the camera frame of reference
void specialKeys(int key, int x, int y) {
	float linear = 0.1f;
	float angular = float(m3dDegToRad(5.0f));

	if(key == GLUT_KEY_UP) {
		cameraFrame.MoveForward(linear);
		//modelViewMatrix.Translate(0.0f, -0.7f, 0.0f);
		//cameraFrame.MoveUp(linear);
		//objectFrame.RotateLocal(linear, 1.0f, 0.0f, 0.0f);
	}

	if(key == GLUT_KEY_DOWN) {
		cameraFrame.MoveForward(-linear);
		//cameraFrame.MoveUp(-linear);
		//objectFrame.RotateLocal(-linear, 1.0f, 0.0f, 0.0f);
	}

	if(key == GLUT_KEY_LEFT) {
		cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
		//objectFrame.RotateLocal(-linear, 0.0f, 0.0f, 1.0f);
	}

	if(key == GLUT_KEY_RIGHT) {
		cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
		//objectFrame.RotateLocal(linear, 0.0f, 0.0f, 1.0f);
	}
}
